//
//  ZaiXianHaoYou.m
//  HallView
//
//  Created by Lv Changye on 11-7-21.
//  Copyright 2011年 139me. All rights reserved.
//

#import "ZaiXianHaoYou.h"


@implementation ZaiXianHaoYou

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
	NSLog(@"haoyou dealloc");
    [haoyouTable release];
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    UIView *restrictView=[[UIView alloc]initWithFrame:CGRectMake(7, 63, 167, 218)];
    [restrictView.layer setCornerRadius:10.0f];
    restrictView.backgroundColor=[UIColor clearColor];
    [self.view addSubview:restrictView];
    
    if (haoyouTable==nil) {
        haoyouTable=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, 167, 218) style:UITableViewStylePlain];
        haoyouTable.backgroundColor=[UIColor clearColor];
        haoyouTable.delegate=self;
        haoyouTable.dataSource=self;
        haoyouTable.separatorColor=[UIColor colorWithWhite:0.8 alpha:0.5];
    }
    haoyouTable.clipsToBounds=YES;
    [haoyouTable.layer setCornerRadius:10.0f];
    [restrictView addSubview:haoyouTable];
    [restrictView release];
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    haoyouTable=nil;
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}
-(void)viewWillAppear:(BOOL)animated{
    [haoyouTable reloadData];
    [super viewWillAppear:animated];
}
-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}


#pragma mark --TableViewDelegate--
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 20;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    //NSInteger section=[indexPath section];
    NSUInteger row=[indexPath row];
    static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
	UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdentifier];
	if (cell == nil) {
		cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier]autorelease];
    }
    cell.textLabel.text=[NSString stringWithFormat:@"好友%d",row+1];
    cell.textLabel.font=[UIFont systemFontOfSize:18];
    //cell.backgroundColor=[UIColor clearColor];
    
    cell.textLabel.backgroundColor=[UIColor clearColor];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 30;
}
@end
